package ${package};

import com.miwzn.base.AbstractController;
import ${tableClass.fullClassName};
import ${qmPo}.${tableClass.shortClassName}Query;
import ${dtoPo}.${tableClass.shortClassName}Dto;
import ${servicePackage}.${tableClass.shortClassName}Service;
import com.miwzn.comm.ResponseEntity;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

<#assign dateTime = .now>
/**
 * @Author: ${author}
 * @Date: ${dateTime?string["yyyy-MM-dd HH:mm:ss"]}
 * @Description: ${description} mvc api
 */
@ResponseBody
@Controller
@RequestMapping("${requestMapping}")
public class ${tableClass.shortClassName}Controller extends AbstractController<${tableClass.shortClassName}, ${tableClass.shortClassName}Dto, ${tableClass.shortClassName}Query> {
    private static Logger logger = LoggerFactory.getLogger(${tableClass.shortClassName}Controller.class);

    @Autowired
    private ${tableClass.shortClassName}Service ${tableClass.variableName}Service;

    /**
     * 根据ID获取信息
     *
     * @param id
     *
     * @return
     */
    @RequiresPermissions("${permission}:getById")
    @GetMapping("/getById/{id}")
    public ResponseEntity getById(@PathVariable("id") String id) {
        return super.getById(id);
    }

    /**
     * 列表
     *
     * @param entity
     *
     * @return
     */
    @RequiresPermissions("${permission}:list")
    @GetMapping("/list")
    public ResponseEntity list(${tableClass.shortClassName}Query entity) {
        return super.listD(entity);
    }

    /**
     * 添加
     *
     * @param entity
     *
     * @return
     */
    @RequiresPermissions("${permission}:add")
    @PostMapping("add")
    public ResponseEntity add(@RequestBody ${tableClass.shortClassName}Dto entity) {
        return super.add(entity);
    }

    /**
     * 更新
     *
     * @param entity
     *
     * @return
     */
    @RequiresPermissions("${permission}:update")
    @PutMapping("update")
    public ResponseEntity update(@RequestBody ${tableClass.shortClassName}Dto entity) {
        return super.update(entity);
    }

    /**
     * 软删除
     *
     * @param id
     *
     * @return
     */
    @RequiresPermissions("${permission}:delFlag")
    @DeleteMapping("/delFlag/{id}")
    public ResponseEntity deleteFlag(@PathVariable("id") String id) {
        return super.deleteFlag(id);
    }

    /**
     * 软删除
     *
     * @param ids
     *
     * @return
     */
    @RequiresPermissions("${permission}:delFlag")
    @DeleteMapping("/delFlag")
    public ResponseEntity deleteFlag(@RequestBody String[] ids ) {
        return super.deleteFlag(ids);
    }

    /**
     * 硬删除
     *
     * @param id
     *
     * @return
     */
    @RequiresPermissions("${permission}:del")
    @DeleteMapping("/del/{id}")
    public ResponseEntity delete(@PathVariable("id") String id) {
        return super.delete(id);
    }

    /**
     * 硬删除
     *
     * @param ids
     *
     * @return
     */
    @RequiresPermissions("${permission}:del")
    @DeleteMapping("/del")
    public ResponseEntity delete(@RequestBody String[] ids ) {
        return super.delete(ids);
    }

}